home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group98b.txt
/
000109_icon-group-sender _Mon Jun 29 08:41:51 1998.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
2KB
Return-Path: <icon-group-sender>
Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
by baskerville.CS.Arizona.EDU (8.8.8/8.8.7) with SMTP id IAA06745
for <icon-group-addresses@baskerville.CS.Arizona.EDU>; Mon, 29 Jun 1998 08:41:51 -0700 (MST)
Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
id AA29145; Mon, 29 Jun 1998 08:41:39 -0700
Date: Sun, 28 Jun 1998 22:37:17 -0500
Message-Id: <199806290337.WAA12295@segfault.cs.utsa.edu>
From: Clinton Jeffery <jeffery@segfault.cs.utsa.edu>
To: rwg@fns.com
Cc: icon-group@optima.CS.Arizona.EDU
In-Reply-To: <35970836.34465163@fns.com> (message from Robbie Gilbert on Sun,
28 Jun 1998 23:21:26 -0400)
Subject: Re: Forcing Generator to Return a List of Values
Reply-To: jeffery@segfault.cs.utsa.edu
Errors-To: icon-group-errors@optima.CS.Arizona.EDU
Status: RO
Content-Length: 1299
[Robbie Gilbert provides a helper procedure and uses co-expression invocation
p{} to solve his problem of turning a generator's result sequence into a list.]
Hi Robbie,
You've got some coding problems to fix, but when you fix them the general
approach you describe will work and is attractively concise. However, it is
not cheap. If you need to do this 10 times in your program, you have a
great solution. If you need to do it many thousands of times, you had best
not create a new co-expression every time you capture a generator's results.
The reason is that each co-expression requires substantial memory for its
own stack, and the memory for co-expressions is not allocated and reclaimed
in the same, efficient way that most Icon values are.
This is just my impression. I am a big co-expression advocate and would
welcome corrections and anecdotes from persons who have happily used
thousands of co-expressions in a single program!
Remember, you are only going to save one line of code over:
L := []
every put(L, generator_expression)
Perhaps if you do an experiment and collect some timings, that will influence
you!
Cheers,
Clint Jeffery, jeffery@cs.utsa.edu
Division of Computer Science, The University of Texas at San Antonio
Research http://www.cs.utsa.edu/research/plss.html